Skip to content

feat(fleet): derived per-app versioning from tags (#8566) - #8630

Merged
dezren39 merged 3 commits into
mainfrom
queue/14886-8566-derived-versioning
Nov 11, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/14886-8566-derived-versioning

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #8566. Implements the versioning policy Drew ruled on #5790 (2026-11-06, refined same day).

What

  • Derivation module (pkgs/fleet/crates/fleet/src/derived_version.rs, pure, shared with the build script by path): nearest <app>/vX.Y.Z tag exactly → X.Y.Z; N commits after it on main → X.Y.(Z+1)-dev.N+g<shorthash>; feature branch adds +<branch-slug>; no tag yet → the 0.1.0-dev fallback family (bare 0.1.0-dev only for a history-less build).
  • Build bake (build.rs): git describe --tags --long --match 'fleet/v*' (short app name = tag prefix, the one policy for all apps) transformed by the module; $FLEET_DERIVED_VERSION is the packaged-build channel, the same shape as the existing FLEET_SOURCE_REV bake.
  • Surface: fleet version, fleet capabilities (build.derived_version), root --version, and the queue --version shortcut all report Derived version: ... alongside the source rev — the channel --version and the Fleet path Nix-build state: deployed fleet lags pkgs/fleet HEAD; remaining non-Nix pieces #5760 deployed-state checks consume.
  • Docs: README gains the tag/release procedure where the fleet release tooling lives — per-app short-name tags, first tag 0.1.0, stay in 0.x (minor = features, patch = fixes, no major bumps until a separate 1.0 decision), releases are tag builds only, main deploys are prereleases, repo tags repo/v<YYYYMMDD>.<minor>.<patch> at release points (prerelease repo tags on deploys allowed), deploy truth read from the binary itself.
  • Smoke: smoke.sh asserts the derived-version line on the repo-queue and fleet version surfaces.

Tests

fleet 0.1.0
Derived version: 0.1.0-dev.11339+g3c42146+queue-14886-8566-derived-version
Source rev: 3c4214625c72

Out of scope per #8566: cutting the first real release tags, any 1.0 move, and the #5760 drift-check work itself.

Queue: task 14886, lane code-d.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Implement the #5790 ruled policy (2026-11-06) for the fleet apps in
pkgs/fleet: the version a binary reports is derived at build time,
never a hand-maintained literal.

- New pure derivation module (crates/fleet/src/derived_version.rs,
  shared with build.rs by path): nearest <app>/vX.Y.Z tag exactly ->
  X.Y.Z; N commits after on main -> X.Y.(Z+1)-dev.N+g<shorthash>;
  feature branch adds +<branch-slug>; no tag yet -> the 0.1.0-dev
  fallback family. 9 unit tests whose oracle is the #5790 sec.1
  policy text (tag-present, no-tag, prerelease-from-main cases).
- build.rs bakes FLEET_DERIVED_VERSION via git describe --match
  'fleet/v*' (short app name = tag prefix for all apps), with
  $FLEET_DERIVED_VERSION as the packaged-build channel - the same
  channel shape as the existing FLEET_SOURCE_REV bake.
- Surface: `fleet version`, `fleet capabilities` (build.
  derived_version) and every --version form now print
  `Derived version: ...` alongside the source rev, so --version and
  the #5760 deployed-state checks can consume it.
- README gains the tag/release procedure where the fleet release
  tooling lives: per-app short-name tags, first tag 0.1.0, stay in
  0.x (minor = features, patch = fixes, no major bumps), releases
  are tag builds only, main deploys are prereleases, repo tags
  repo/v<YYYYMMDD>.<minor>.<patch> at release points (prerelease
  repo tags on deploys allowed).
- smoke.sh asserts the derived-version line on the version surfaces.

Tests: cargo test -p fleet --locked - 28+1+7 passed. A binary built
from this branch reports: Derived version:
0.1.0-dev.11339+g3c42146+queue-14886-8566-derived-version
(no fleet/v* tag exists yet, so the no-tag fallback on a feature
branch is the live proof).

Out of scope per #8566: cutting the first real tags, any 1.0 move,
the #5760 drift-check work itself.
@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 09:35
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b229df96-ca2e-4e8c-acb4-9a3305a019ab
Commits

Reviewing files that changed from the base of the PR and between e599220 and f7ae1df.

Files selected for processing: 6

  • pkgs/fleet/README.md
  • pkgs/fleet/crates/fleet/build.rs
  • pkgs/fleet/crates/fleet/src/derived_version.rs
  • pkgs/fleet/crates/fleet/src/main.rs
  • pkgs/fleet/default.nix
  • pkgs/fleet/smoke.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T09:58:18.241872Z f7ae1df Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

Copy link
Copy Markdown
Member Author

@codex review

Please review this PR: derived per-app versioning for the fleet binary (#8566, policy #5790). Focus on the derivation transform in derived_version.rs (semver ordering of the -dev.N form, tag parsing edge cases), the build.rs git-describe bake (fallbacks when git history is absent), and any regression risk on the existing version surfaces.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e95fe4151b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/fleet/crates/fleet/build.rs Resolved
Comment thread pkgs/fleet/crates/fleet/build.rs Resolved
Comment thread pkgs/fleet/crates/fleet/build.rs Resolved
Four findings from the Codex review of e95fe41, all accepted:

1. SemVer build metadata permits ONE '+' separator: the feature
   branch slug now dot-joins the hash identifier
   (0.4.3-dev.7+g1a2b3c4.ws-h-versioning) instead of a second '+'.
   The #5790 policy text's example spelling is corrected in the
   module docs and the README table; a regression test asserts
   every derived form carries at most one '+'.
2. The packaged (nix) build now produces the derived version:
   pkgs/fleet/default.nix takes a derivedVersion argument (release
   tooling passes the clean tag version for a tag build, where the
   git history exists) and otherwise derives a unique prerelease
   from sourceRev (0.1.0-dev+g<rev7>) - no more colliding bare
   0.1.0-dev from every packaged build. README step 3 documents it.
3. A malformed nearest tag (fleet/v01.2.3, fleet/v0.4.3-rc.1) no
   longer hides a valid older release tag: when parse_describe
   rejects describe's pick, build.rs scans reachable fleet/v*
   tags, keeps only validated <app>/vX.Y.Z ones, and derives from
   the nearest (ties: highest version).
4. build.rs registers the git refs it reads (refs/tags,
   packed-refs, HEAD) as rerun-if-changed inputs, so cutting a
   release tag on an already-built tree invalidates the bake.

Verified live in the worktree: with fleet/v01.2.3 tagged at HEAD
(describe's pick) and fleet/v0.1.0 at HEAD~1, a build reports
0.1.1-dev.1+ge95fe41.queue-14886-8566-derived-version; with
fleet/v0.1.0 at HEAD, a source-unmodified rebuild reports clean
0.1.0; with the tags deleted it reports the 0.1.0-dev fallback
again. cargo test -p fleet --locked: 29+1+7 passed.
@dezren39

Copy link
Copy Markdown
Member Author

@codex review

Re-review head 605e3e2: all four P2 findings from the first round are fixed (dot-joined build metadata, nix derivedVersion wiring, validated-tag scan fallback, git-ref rerun inputs), each dispositioned on its thread with live verification evidence. Please confirm the fixes and check the new code paths.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 605e3e255a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/fleet/crates/fleet/build.rs Resolved
Codex round-2 P2 on 605e3e2: the rerun watcher tracked HEAD,
refs/tags and packed-refs, but on an attached HEAD an ordinary
commit updates the loose branch ref (refs/heads/<branch>, in the
common dir for linked worktrees) - HEAD is only the symref naming
it and never changes content - so a rebuild after an unrelated
commit could keep the previous commit's derived version and
source rev.

rerun_on_git_refs now also watches refs/heads (the directory
covers a ref's first loose creation out of packed-refs) and the
resolved current branch ref itself (git symbolic-ref -q HEAD,
joined to the common dir).

Verified live before this commit: an empty commit on the branch
with no source edits moved the rebuilt binary from
0.1.0-dev.11341+g605e3e2... to 0.1.0-dev.11342+g4855f7a...
(distance and hash both refreshed). cargo test -p fleet
--locked: 29+1+7 passed.
@dezren39

Copy link
Copy Markdown
Member Author

@codex review

Round 3, head f7ae1df: the round-2 P2 (watch the current branch ref as well as HEAD) is fixed and dispositioned on its thread with live verification (an empty commit refreshed both the derived distance and the source rev on a source-unmodified rebuild). Please confirm.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: f7ae1dfc4c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

impl(fleet): derived versioning for individually deployed apps (follow-on to #5790 rulings)

1 participant